﻿using System;
using System.Collections;
using System.Windows;
using System.Windows.Forms;
using HR60_PanelSoft.Model;
using HR60_PanelSoft.Model.BaseModel;
using HR60_PanelSoft.View.Base;
using HR60_PanelSoft.View.Controls;

namespace HR60_PanelSoft.View.TabForms
{
	public partial class ProjPage : BaseForm
	{
		public ProjPage()
		{
			InitializeComponent();

			// 初始化样式列表
			Hashtable styleMap = new Hashtable();
			styleMap.Add("清爽", UIStyle.QingShuang);
			styleMap.Add("奢华", UIStyle.SheHua);
			selProjStyle.bindData(styleMap);
		}

		// 绑定数据
		public override void refreshFormData(System.Collections.Generic.IDictionary<string, object> dataMap)
		{
			txtProjName.Value = proj.name;
			txtProjWriter.Value = proj.writer;
			txtProjDate.Value = proj.date.ToShortDateString();
			txtProjAddr.Value = proj.addr;
			selProjStyle.Value = proj.defaultStyle;
		}

		// 数据修改事件
		public override void onFormChanged(BaseFormControl sender, System.EventArgs e)
		{
			windowMain.doSaveProj(this.getFields());
		}
	}
}
